package com.coincalf.entity;

import com.baomidou.mybatisplus.enums.IdType;

import java.math.BigDecimal;
import java.util.Date;

import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableName;

import java.io.Serializable;

import com.baomidou.mybatisplus.annotations.Version;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

/**
 * <p>
 * 创新交易持仓信息
 * </p>
 *
 * @author qiang
 * @since 2018-05-12
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
@TableName("forex_account")
public class ForexAccount extends Model<ForexAccount> {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @TableId(value = "id", type = IdType.ID_WORKER)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    /**
     * 用户ID
     */
    @TableField("user_id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long userId;

    /**
     * 交易对ID
     */
    @TableField("market_id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long marketId;

    /**
     * 交易对
     */
    @TableField("market_name")
    private String marketName;

    /**
     * 持仓方向：1-买；2-卖
     */
    private Integer type;

    /**
     * 持仓量
     */
    private BigDecimal amount;

    /**
     * 冻结持仓量
     */
    @TableField("lock_amount")
    private BigDecimal lockAmount;

    /**
     * 状态：1-有效；2-锁定；
     */
    private Integer status;

    /**
     * 修改时间
     */
    @TableField("last_update_time")
    private Date lastUpdateTime;

    /**
     * 创建时间
     */
    private Date created;

    public ForexAccount(Long userId, Long marketId, String marketName, Integer type, BigDecimal amount, BigDecimal lockAmount, Integer status, Date lastUpdateTime, Date created) {
        this.userId = userId;
        this.marketId = marketId;
        this.marketName = marketName;
        this.type = type;
        this.amount = amount;
        this.lockAmount = lockAmount;
        this.status = status;
        this.lastUpdateTime = lastUpdateTime;
        this.created = created;
    }

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
